function [F] = Gen_Patch_Feature(I, nbin)
%Input:
%   I: one image patch
%   nbin: n-bins of histogram 
%Output:
%   F: the feature： RGB; YUV/YCbCr; hog; LBP
F=[];
ix_feat =0;
% RGB Channel-3
Irgb = reshape(double(I),[],3);
F(:, [1:3]) = hist(Irgb, 0:256/nbin:255);

ix_feat =size(F,2);
% YUV/YCbCr channel-3
Iyuv =rgb2ycbcr(uint8(I));
Iyuv = double(reshape(Iyuv,[],3));
F(:, ix_feat+1) = hist(Iyuv(:,1), 16:((235-15)/nbin):235);
F(:, ix_feat+[2:3]) = hist(Iyuv(:,2:3), 16:((240-15)/nbin):240);

ix_feat =size(F,2);
% HSV Channel: HS-2
Ihsv =rgb2hsv(uint8(I));
Ihsv = double(reshape(Ihsv,[],3));
F(:, ix_feat+[1:2]) = hist(Ihsv(:,1:2), 1e-5:1/nbin:1); %by column

F= bsxfun(@times, F, 1./sum(F)); % normalization
F= F(:);
ix_feat =size(F,1);
% Uniform LBP 
% LBP_Mapping = getmapping(16,'u2'); LBPname= 'n16u2';
% radius = 2;
% Igray =rgb2gray(uint8(I));
% stmp = lbp(Igray,radius,LBP_Mapping.samples,LBP_Mapping,'nh')';
% F(ix_feat+[1:LBP_Mapping.num]) = stmp;
Is = single(uint8(I));
hog = vl_hog(Is,8);
hog = hog(:);
Is = single(rgb2gray(uint8(I)));
lbp = vl_lbp(Is,8);
lbp= lbp(:);
all_h_l = [hog;lbp];
num_h_l = length(all_h_l);
F(ix_feat+[1:num_h_l])=all_h_l;
end